/**
 * ===========================================
 * Project: cy-qbadmin
 * ===========================================
 * Package: com.cyou.qb.admin.service
 * 
 * Copyright (c) 2012, CYOU All Rights Reserved.
 * ===========================================
 */
package com.cyou.qb.common.service;

import java.io.IOException;
import java.text.ParseException;
import java.util.Date;
import java.util.List;

import com.cyou.nad.dao.PojoPage;
import com.cyou.nad.datastore.query.JdbcPage;
import com.cyou.qb.common.domain.Active;
import com.cyou.qb.common.domain.QiangbaAdmin;
import com.cyou.qb.face.entity.NameValue;
import com.cyou.qb.service.BaseService;

/**
 * <p>ActivityService</p>
 * <p>
 * Description:活动管理service
 * </p>
 *
 * @author lidongwei
 * @version 
 * @since 2012-9-23
 */
public interface ActivityService extends BaseService {

	/**
	 * <p>活动查询</p>
	 * 根据活动ID查询唯一活动
	 * @author zoudongchao
	 * @param activeId 活动ID
	 * @return
	 */
	public Active findActivity(int activeId);

	/**
	 * 分页查询 活动，按照指定方式进行排序    前台抽奖页使用
	 * @param oderBy
	 * @return
	 */
	public PojoPage<Active> pageQuery(String oderBy, int pageNo, int pageSize);

	/**
	 * 查找所有未删除的已经发布活动
	 * @return
	 */
	public List<Active> findAllActive();

	/**
	 * Description
	 * @author lidongwei 添加
	 * @throws ParseException 
	 * @throws IOException 
	 * @throws Exception 
	 * @since 2012-9-19
	 */
	public int saveOneActivity(String activeNmae, String gameCode, String gameNmae, String gameType, String gameComOp,
			String gameComRd, String gameChannel, String gameNet, String gameBBS, String gameDown, String image1,
			String image2, String image2Link, String startTime, String endTime, String memo, String introduce,
			int adminId, String rule) throws ParseException, Exception;
	/**
	 * 修改一个活动
	 * Description
	 * @author lidongwei
	 * @since 2012-10-30
	 */

	public int updateOneActivity(String activeId, String activeNmae, String gameCode, String gameNmae, String gameType,
			String gameComOp, String gameComRd, String gameChannel, String gameNet, String gameBBS, String gameDown,
			String image1, String image2, String image2Link, String startTime, String endTime, String memo,
			String introduce, String rule) throws Exception;

	/**
	 * Description 删除
	 * @author lidongwei
	 * @throws Exception 
	 * @since 2012-9-19
	 */
	public int removeActivity(String activityId) throws Exception;

	/**
	 * Description 根据条件获取活动，并将其存储在分页中
	 * @author lidongwei
	 * @param admin 
	 * @throws Exception 
	 * @since 2012-9-23
	 */
	public JdbcPage findPageQueryActivity(QiangbaAdmin admin, String state, String activityType, String activityName,
			int pageNo, int pageSize) throws Exception;

	/**
	 * Description 发布一个活动
	 * @author lidongwei
	 * @throws Exception 
	 * @since 2012-10-5
	 */
	public void updatePublishAcitivity(String activityId) throws Exception;
	/**
	 * 
	 * Description 检查预览
	 * @author lidongwei
	 * @since 2012-10-30
	 */

	public boolean checkPreview(int i) throws Exception;

	/**
	 * Description 关闭或者开启一个活动
	 * @author lidongwei
	 * @throws Exception 
	 * @since 2012-10-6
	 */
	public void updateCloseOpenActivity(String activityId) throws Exception;

	/**
	 * Description 活动充值
	 * @author lidongwei
	 * @param i 
	 * @param string 
	 * @throws Exception 
	 * @since 2012-10-6
	 */
	public void updateRechargeGold(String acId, String gbNum, String accId, int i) throws Exception;

	/**
	 * 获取活动状态：1 尚未进行，2：正在进行，3：已经结束，4：关闭
	 * Description
	 * @author lidongwei
	 * @since 2012-10-7
	 */
	public int findFaceStatus(String activityId);

	/**
	 * <p>查找已经结束N天的活动</p>
	 * 如，已结束3天，则查找活动结束时间为now-3与now-2之间的活动
	 * @author zoudongchao
	 * @param days 活动已结束天数
	 * @return
	 */
	public List<Active> findEndedActivity(int days);

	/**
	 * <p>更新活动抽奖次数</p>
	 * @param id	活动id
	 * @param drawTimes	抽奖次数
	 * @return	受影响的行数
	 */
	public int updateActiveDrawNum(int id, long drawTimes);

}
